package com.isp.org.server.domain.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.isp.org.server.domain.entity.RoleEntity;
import com.isp.org.server.domain.mapper.RoleMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author linsy
 * @version 1.0
 * @created 2024/3/13 10:14
 */
@Service
@RequiredArgsConstructor
public class RoleService extends ServiceImpl<RoleMapper, RoleEntity> {

    private final RoleMapper roleMapper;

    public List<RoleEntity> findByApp(String app) {
        return roleMapper.findByApp(app);
    }

    /**
     * 根据code查询
     *
     * @param app  app
     * @param code code
     * @return 响应
     */
    public RoleEntity findByCode(String app, String code) {
        return roleMapper.findByCode(app, code);
    }

    /**
     * 根据角色id查询
     *
     * @param app app
     * @param id  角色id
     * @return 响应
     */
    public RoleEntity findById(String app, Long id) {
        return roleMapper.findById(app, id);
    }
}
